package demo.spring.framework.test;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import demo.db.mybatis.service.UserService;

/**
 * 除了可以用常规的Junit进行单元测试之外，我们还可以使用Spring提供的Junit测试框架进行单元测试
 *
 */
@RunWith(SpringJUnit4ClassRunner.class)
// 配置了@ContextConfiguration注解并使用该注解的locations属性指明spring和配置文件之后，
@ContextConfiguration(locations = { "classpath:spring.xml", "classpath:spring-mybatis.xml" })
public class SpringJUnitDemo {

    @Autowired
    private UserService userService;

    @Test
    public void test() {
        System.out.println("hello world.");
    }

}
